/*
* Copyright (c) 2014 Qunar.com. All Rights Reserved.
*/
package net.oschina.bilbodai.concurrent;

import net.oschina.bilbodai.concurrent.annotation.DPSRate;
import net.oschina.bilbodai.concurrent.annotation.QPSRate;
import net.oschina.bilbodai.concurrent.annotation.RateLimit;

/**
 * @author daimao  Date: 15/10/13 Time: 下午10:38
 * @version $Id$
 */
@RateLimit
public class HelloService {

    @QPSRate(rate = 1)
    public void sayPerSecond() {
        System.out.println("say one per second");
    }

    @QPSRate(rate = 0.5)
    public void sayPer2Second() {
        System.out.println("say one per 2 seconds");
    }

    public void sayData(@DPSRate(rate = 1) byte[] data) {
        System.out.println("say data ");
    }

    @QPSRate(key = "sayTwicePerSecond",rate = 2)
    public void sayTwicePerSecond() {
        System.out.println("sayTwicePerSecond");
    }

    @QPSRate(key = "sayTwicePerSecond")
    public void alsoSayTwicePerSecond() {
        System.out.println("alsoSayTwicePerSecond");
    }
}